<%-- 
    Document   : home
    Created on : 18 nov. 2013, 14:34:34
    Author     : smng2095
--%>

<%@page import="java.io.PrintWriter"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<%		if (request.getSession() == null) {

        RequestDispatcher dispatcher
                = getServletContext().getRequestDispatcher("/dispatcheur");
        dispatcher.forward(request, response);
    } else if (request.getSession().getAttribute("authentified") == null) {

        RequestDispatcher dispatcher
                = getServletContext().getRequestDispatcher("/dispatcheur");
        dispatcher.forward(request, response);

    } else if (!((String) request.getSession().getAttribute("authentified")).equalsIgnoreCase("yes")) {
        RequestDispatcher dispatcher
                = getServletContext().getRequestDispatcher("/dispatcheur");
        dispatcher.forward(request, response);
    }
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>RIE07-Monitoring</h1>
        <%  try {

                if (request.getAttribute("error") != null) {
                    out.print(((String) request.getAttribute("error")));
                }
                request.removeAttribute("error");
                if (request.getAttribute("info") != null) {
                    out.print(((String) request.getAttribute("info")));
                }
                request.removeAttribute("info");
            } catch (Exception ex) {

            }

        %>
        <br />
        Liste des Adresses IP pour l'utilisateur <% out.println(session.getAttribute("login")); %> : <br />
        <br />
        <% if (((String) request.getAttribute("iPs")) == null) {
                out.println("nothing");
            } else {
                String[] temp = ((String) request.getAttribute("iPs")).split(" ");
                for (int i = 0; i < temp.length; i++) {
                       out.println(temp[i] + "<br />");
                   }
               }%>

        <br />   
        <form action="/Web_Login_IP/ajoutIP" method="POST">
            IP à ajouter :                <INPUT type=text size=20 name=ipAdress><BR>
            <button type="submit">Ajouter</button>                     
        </form>

        <form action="/Web_Login_IP/suppressionIP" method="POST">
            IP à supprimer : 
            <FORM>
                <select name="ipAddressDel" size="1">		    
                    <%
                        if (((String) request.getAttribute("iPs")) == null) {

                        } else {
                            String[] temp = ((String) request.getAttribute("iPs")).split(" ");
                            for (int i = 0; i < temp.length; i++) {
                                out.println("<option> " + temp[i]);
                            }
                        }

                    %>
                </select>    
                <button type="submit">Supprimer</button>                     
            </form>

            <form action="/Web_Login_IP/interrogationIP" method="POST">
                IP à interroger :                          
                <INPUT type=text size=20 name=ipAddressInt><BR>
                <INPUT type="checkbox" name="listProcess" value="1"> liste des processus <br>
                <INPUT type="checkbox" name="memory" value="1"> mémoire libre <br>
                <INPUT type="checkbox" name="cpu" value="1"> processeur <br>
                <button type="submit">Envoi</button>
            </form>

            <form action="/Web_Login_IP/historique" method="POST">
                <button type="submit">Historique</button>
            </form>

            <form action="/Web_Login_IP/deconnexion" method="POST">
                <button type="submit">Déconnexion</button>
            </form>       



    </body>
</html>
